//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.baidu.trace;

import android.app.Notification;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import com.baidu.lbsapi.auth.tracesdk.LBSAuthManager;
import com.baidu.trace.IService.Stub;
import com.baidu.trace.api.fence.CircleFence;
import com.baidu.trace.b.c;
import com.baidu.trace.b.d;
import com.baidu.trace.c.e;
import com.baidu.trace.c.f;
import com.baidu.trace.c.h;
import com.baidu.trace.c.f.b;
import com.baidu.trace.model.CoordType;
import com.baidu.trace.model.LatLng;
import com.baidu.trace.model.LocationMode;
import com.baidu.trace.model.ProtocolType;
import com.baidu.trace.model.TraceLocation;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;

public final class LBSTraceService extends Service {
    private LBSTraceService.a a = new LBSTraceService.a(this);
    private LBSTraceService.ServiceBinder b = new LBSTraceService.ServiceBinder(this);
    private d c = null;
    private bd d = null;
    private Context e;
    private s f;
    private boolean g = false;
    private IListener h = null;
    private boolean i = false;
    private boolean j = false;
    private c k = new c();
    private int l;
    private int m;
    private b n;

    public LBSTraceService() {
        this.l = LocationMode.High_Accuracy.ordinal();
        this.m = ProtocolType.HTTPS.ordinal();
        this.n = b.a;
    }

    public final void onCreate() {
        super.onCreate();
        this.e = this.getApplicationContext();
        this.f = new s(this.e);
        av.a(this.e);
        bc.a().a(this.a);
        this.c = d.a();
        this.c.a(this.a, this.e);
        if(com.baidu.trace.d.b == null) {
            com.baidu.trace.d.b = LBSAuthManager.getInstance(this.e);
        }

        q.a(this.e, com.baidu.trace.d.b);
        e.a(this.e);
        am.a(this.e);
        SharedPreferences var1;
        if((var1 = PreferenceManager.getDefaultSharedPreferences(this.e)).contains("cacheSize")) {
            am.a(var1.getInt("cacheSize", 0));
        }

        String var10000 = e.c;
        h.b();
        if(com.baidu.trace.d.a == null) {
            com.baidu.trace.d.a();
        }

    }

    public final IBinder onBind(Intent var1) {
        return this.b;
    }

    public final int onStartCommand(Intent var1, int var2, int var3) {
        boolean var38 = false;
        boolean var40 = false;
        int var4 = 0;
        String var45;
        if(var1 != null) {
            if(var1.hasExtra("processID")) {
                Editor var6 = PreferenceManager.getDefaultSharedPreferences(this.e).edit();
                if(var1.getIntExtra("processID", Process.myPid()) != Process.myPid()) {
                    var6.putBoolean("same_process", false);
                } else {
                    var6.putBoolean("same_process", true);
                }

                var6.apply();
            }

            if(var1.hasExtra("operateType")) {
                var4 = var1.getIntExtra("operateType", 0);
            }

            if(var4 == 0) {
                boolean[] var10000;
                if(var1 == null) {
                    var10000 = new boolean[]{false, false};
                } else {
                    Bundle var5 = null;
                    if(var1.hasExtra("initData")) {
                        var5 = var1.getBundleExtra("initData");
                    }

                    if(var5 == null) {
                        var10000 = new boolean[]{false, false};
                    } else {
                        if(var5.containsKey("notification")) {
                            this.startForeground(1, (Notification)var5.getParcelable("notification"));
                        }

                        if(var5.containsKey("locationMode")) {
                            this.l = var5.getInt("locationMode");
                        }

                        if(var5.containsKey("protocolType")) {
                            this.m = var5.getInt("protocolType");
                        }

                        if(var5.containsKey("gatherInterval")) {
                            Trace.a = var5.getInt("gatherInterval");
                        }

                        if(var5.containsKey("packInterval")) {
                            Trace.b = var5.getInt("packInterval");
                        }

                        if(var5.containsKey("cacheSize")) {
                            Trace.c = var5.getInt("cacheSize");
                            this.b(Trace.c);
                        }

                        if(var5.containsKey("locTimeOffset")) {
                            ar.d = var5.getInt("locTimeOffset");
                        }

                        String var39 = "";
                        if(var5.containsKey("ak")) {
                            var39 = var5.getString("ak");
                        }

                        long var16 = 0L;
                        if(var5.containsKey("serviceId")) {
                            var16 = var5.getLong("serviceId");
                        }

                        String var41 = "";
                        if(var5.containsKey("entityName")) {
                            var41 = var5.getString("entityName");
                        }

                        var45 = "";
                        if(var5.containsKey("mcode")) {
                            var45 = var5.getString("mcode");
                        }

                        String var7 = "";
                        if(var5.containsKey("pcn")) {
                            var7 = var5.getString("pcn");
                        }

                        boolean var8 = false;
                        if(var5.containsKey("isNeedObjectStorage")) {
                            var8 = var5.getBoolean("isNeedObjectStorage");
                            if(this.g) {
                                this.g = var8;
                                var8 = false;
                            } else {
                                this.g = var8;
                            }
                        }

                        if(z.c.equals(var41) && var16 == z.b) {
                            var10000 = new boolean[]{false, var8};
                        } else {
                            z.a = var39;
                            z.b = var16;
                            z.c = var41;
                            z.d = var45;
                            z.e = var7;
                            z.l = f.a;
                            z.m = f.b;
                            this.g();
                            StringBuffer var42;
                            (var42 = new StringBuffer()).append(z.a).append("-|-").append(z.b).append("-|-").append(z.c).append("-|-").append(z.d).append("-|-").append(z.e).append("-|-").append(z.l).append("-|-").append(z.m).append("-|-").append(this.l).append("-|-").append(this.m).append("-|-").append(this.g);
                            var39 = var42.toString();
                            this.f.a("client", var39);
                            this.f.a();
                            var10000 = new boolean[]{true, false};
                        }
                    }
                }

                boolean[] var43 = var10000;
                var38 = var10000[0];
                var40 = var43[1];
            }
        } else {
            HashMap var44 = null;

            try {
                var45 = this.f.a("client");
                var44 = var45 != null?a(var45):null;
                if(var44 != null && var44.size() >= 10) {
                    z.a = (String)var44.get("ak");
                    z.b = Long.parseLong((String)var44.get("serviceId"));
                    z.c = (String)var44.get("entityName");
                    z.d = (String)var44.get("mcode");
                    z.e = (String)var44.get("pcn");
                    z.l = (String)var44.get("md");
                    z.m = (String)var44.get("cpu");
                    this.l = Integer.parseInt((String)var44.get("locationMode"));
                    this.m = Integer.parseInt((String)var44.get("protocolType"));
                    com.baidu.trace.c.a.b = this.m == 0?ProtocolType.HTTP:ProtocolType.HTTPS;
                    this.g = Boolean.valueOf((String)var44.get("isNeedObjectStorage")).booleanValue();
                    bd.d = TextUtils.isEmpty(this.f.a("is_gather"))?false:Boolean.valueOf(this.f.a("is_gather")).booleanValue();
                    int var47 = Integer.parseInt(this.f.a("gather_interval"));
                    int var36 = Integer.parseInt(this.f.a("pack_interval"));
                    Trace.a(var47, var36);
                    ar.d = Integer.parseInt(this.f.a("loc_time_offset"));
                }
            } catch (Exception var34) {
                ;
            } finally {
                if(var44 != null) {
                    var44.clear();
                }

            }
        }

        int var46;
        switch(var4) {
            case 0:
                z.a(this.e);

                byte[] var48;
                try {
                    TraceJniInterface.a().setAppInfo(z.a.getBytes(), z.c.getBytes(), z.b, z.d.getBytes(), z.e.getBytes());
                } catch (Exception var33) {
                    var48 = new byte[0];
                    TraceJniInterface.a().setAppInfo(var48, var48, z.b, var48, var48);
                }

                try {
                    TraceJniInterface.a().setDeviceInfo(z.h.getBytes(), z.i.getBytes(), z.j.getBytes(), z.f.getBytes(), z.g.getBytes(), z.k.getBytes(), z.l.getBytes(), z.m.getBytes());
                } catch (Exception var32) {
                    var48 = new byte[0];
                    TraceJniInterface.a().setDeviceInfo(var48, var48, var48, var48, var48, var48, var48, var48);
                }

                if(b.a == this.n) {
                    this.b(true, false);
                    if(ar.a == null) {
                        ar.a = new aj(this.e);
                    }

                    (new am(1, z.c)).start();
                }

                LBSTraceService var37 = this;
                if(var38) {
                    bd.a(false);
                    com.baidu.trace.c.a.a.execute(new aq(this));
                }

                if(!d.a(this.e)) {
                    com.baidu.trace.a.a("BaiduTraceSDK", "current network is not available");
                    this.e();
                } else if(var38) {
                    this.n = b.b;
                    if(this.c != null) {
                        this.c.b();
                    }

                    TraceJniInterface.a().socketDisconnection();
                    if(this.c != null) {
                        this.c.c();
                    }
                } else {
                    switch(LBSTraceService.SyntheticClass_1.a[this.n.ordinal()]) {
                        case 1:
                            if(this.h != null) {
                                try {
                                    var37.h.startTraceCallback(22);
                                } catch (Exception var31) {
                                    ;
                                }

                                return 1;
                            }

                            return 1;
                        case 2:
                            if(this.h != null) {
                                try {
                                    var37.h.startTraceCallback(181);
                                } catch (RemoteException var30) {
                                    ;
                                }

                                return 1;
                            }

                            return 1;
                        case 3:
                            this.n = b.b;
                            if(this.c != null) {
                                this.c.b();
                                this.c.c();
                            }

                            return 1;
                        case 4:
                            if(this.h != null) {
                                try {
                                    var37.h.startTraceCallback(25);
                                } catch (RemoteException var29) {
                                    ;
                                }
                            }

                            if(var40 && this.g) {
                                this.a(18, e.a(), (com.baidu.trace.c.f.a)null);
                            }
                    }
                }
                break;
            case 1:
                if(this.h != null) {
                    var46 = bd.d?54:52;

                    try {
                        this.h.startGatherCallback(var46);
                    } catch (RemoteException var28) {
                        ;
                    }
                }

                bd.d = true;
                this.f.a("is_gather", String.valueOf(true));
                this.f.a();
                break;
            case 2:
                if(this.h != null) {
                    var46 = bd.d?55:57;

                    try {
                        this.h.startGatherCallback(var46);
                    } catch (RemoteException var27) {
                        ;
                    }
                }

                bd.d = false;
                this.f.a("is_gather", String.valueOf(false));
                this.f.a();
        }

        return 1;
    }

    public final boolean onUnbind(Intent var1) {
        return super.onUnbind(var1);
    }

    public final void onDestroy() {
        super.onDestroy();
        if(this.c != null && b.d != this.n) {
            this.c.b();
        }

        if(this.j) {
            this.unregisterReceiver(this.k);
            this.j = false;
        }

        try {
            this.stopForeground(true);
        } catch (Exception var2) {
            ;
        }

        if(this.d != null) {
            this.d.a();
            if(null != this.d.a) {
                this.d.a.c();
            }

            this.d.c();
            this.d = null;
        }

        if(this.c != null) {
            this.c.b();
            this.c = null;
        }

        if(this.f != null) {
            this.f.b();
            this.f = null;
        }

        if(!PreferenceManager.getDefaultSharedPreferences(this.e).getBoolean("same_process", true)) {
            com.baidu.trace.d.b();
        }

        ax.b();
        com.baidu.trace.c.b();
        g.b();
        aw.d();
        bd.b();
    }

    protected final void a() {
        if(b.d == this.n) {
            this.i();
        } else {
            if(this.j) {
                this.unregisterReceiver(this.k);
                this.j = false;
            }

            d.a(false);
            if(this.d != null) {
                this.d.a(0L);
            }

            if(b.d == this.n) {
                this.i();
            } else {
                ax.a();
                aw.b();
                if(!this.a(16, e.a(), com.baidu.trace.c.f.a.a)) {
                    this.a(10000);
                } else {
                    if(this.c != null) {
                        this.c.g();
                    }

                }
            }
        }
    }

    protected final void b() {
        if(b.d == this.n) {
            this.i();
        } else {
            if(!this.a(17, e.a(), com.baidu.trace.c.f.a.b)) {
                this.a(10000);
            }

        }
    }

    protected final void c() {
        if(b.d == this.n) {
            this.i();
        } else {
            this.n = b.c;
            if(this.c != null) {
                this.c.f();
                this.c.a(z.c);
            }

            if(this.d != null) {
                this.d.a(true, false);
            } else {
                this.a(true, false);
            }

            if(this.h != null) {
                try {
                    this.h.startTraceCallback(124);
                } catch (RemoteException var3) {
                    ;
                }
            }

            if(this.g) {
                this.a(18, e.a(), (com.baidu.trace.c.f.a)null);
            }

        }
    }

    protected final void a(int var1) {
        if(this.h != null) {
            try {
                this.h.startTraceCallback(var1);
            } catch (RemoteException var2) {
                ;
            }
        }

        this.n = b.a;
        TraceJniInterface.a().socketDisconnection();
        if(this.c != null) {
            this.c.b();
        }

        this.g();
        if(this.d != null) {
            this.d.a();
            if(null != this.d.a) {
                this.d.a.c();
            }

            this.d.c();
            this.d = null;
        }

        bd.b();
    }

    protected final void d() {
        TraceJniInterface.a().socketDisconnection();
        if(this.c != null) {
            this.c.b();
        }

        e.d = 0;
        if(b.d == this.n) {
            this.e(0);
        } else {
            this.b(false, true);
            if(d.a(this.e)) {
                this.n = b.b;
                this.c.c();
            } else {
                this.f(19);
            }
        }
    }

    private void a(boolean var1, boolean var2) {
        if(Trace.b != 30 && Trace.b >= 2) {
            bd.i = Trace.b * 1000;
        }

        if(Trace.a != 5 && Trace.a >= ar.c) {
            ar.b = Trace.a * 1000;
        }

        bd.d();
        if(this.d != null) {
            if(this.d.isAlive()) {
                this.d.a(var1, var2);
                return;
            }

            this.d.c();
            this.d = null;
        }

        this.d = new bd(this);
        this.d.a(var1, var2);
        this.d.start();
    }

    protected final void a(int var1, int var2) {
        if(var1 >= ar.c && var2 >= 2) {
            ar.b = var1 * 1000;
            bd.i = var2 * 1000;
            this.f.a("gather_interval", String.valueOf(var1));
            this.f.a("pack_interval", String.valueOf(var2));
            this.f.a();
        }

        bd.d();
        Trace.a(var1, var2);
    }

    protected final boolean b(int var1) {
        am.a(var1);
        Editor var2;
        (var2 = PreferenceManager.getDefaultSharedPreferences(this.e).edit()).putInt("cacheSize", var1);
        var2.apply();
        return true;
    }

    protected final boolean c(int var1) {
        if(var1 <= 0) {
            return false;
        } else {
            Trace.b(var1);
            ar.d = var1;
            this.f.a("loc_time_offset", String.valueOf(var1));
            this.f.a();
            return true;
        }
    }

    protected final boolean d(int var1) {
        if(this.d != null && null != this.d.a) {
            this.d.a.a(var1);
            return true;
        } else {
            return false;
        }
    }

    protected final void e() {
        d.a(false);
        if(b.d == this.n) {
            this.e(0);
        } else {
            this.f(19);
            this.b(false, true);
        }
    }

    private void b(boolean var1, boolean var2) {
        if(this.d != null) {
            this.d.a(var1, var2);
        } else {
            this.a(var1, var2);
        }
    }

    private void f(int var1) {
        if(this.h != null) {
            try {
                this.h.startTraceCallback(19);
            } catch (RemoteException var2) {
                ;
            }

            this.i = false;
        } else {
            this.i = true;
        }

        this.n = b.b;
        if(!this.j) {
            IntentFilter var3;
            (var3 = new IntentFilter()).addAction("android.net.conn.CONNECTIVITY_CHANGE");
            var3.addAction("com.baidu.trace.action.SOCKET_RECONNECT");
            this.registerReceiver(this.k, var3);
            this.j = true;
        }
    }

    protected final void f() throws RemoteException {
        if(b.a == this.n) {
            if(this.h != null) {
                this.h.stopTraceCallback(27);
            }

        } else {
            if(this.c != null) {
                this.c.e();
            }

            if(b.d == this.n) {
                this.d.a(false, false);
                bd.d = false;
                this.h.stopTraceCallback(182);
            }

            this.n = b.d;
            this.d.a(false, false);
            bd.d = false;
            this.d.e = true;
        }
    }

    protected final void e(int var1) {
        this.g();
        if(this.j) {
            this.unregisterReceiver(this.k);
            this.j = false;
        }

        this.n = b.a;
        e.d = 0;
        if(bd.e() > 0) {
            am.a(true);
        }

        if(!PreferenceManager.getDefaultSharedPreferences(this.e).getBoolean("same_process", true)) {
            am.a();
        }

        try {
            if(this.h != null) {
                if(143 != var1 && !bd.h) {
                    if(141 == var1) {
                        this.h.stopTraceCallback(142);
                    } else {
                        this.h.stopTraceCallback(143);
                    }
                } else {
                    this.h.stopTraceCallback(143);
                }
            }
        } catch (RemoteException var3) {
            ;
        }

        this.stopSelf();
    }

    private static HashMap<String, String> a(String var0) {
        if(TextUtils.isEmpty(var0)) {
            return null;
        } else {
            String[] var3;
            try {
                var3 = var0.split("-\\|-");
            } catch (Exception var2) {
                return null;
            }

            if(var3 != null && var3.length >= 10) {
                HashMap var1;
                (var1 = new HashMap()).put("ak", var3[0]);
                var1.put("serviceId", var3[1]);
                var1.put("entityName", var3[2]);
                var1.put("mcode", var3[3]);
                var1.put("pcn", var3[4]);
                var1.put("md", var3[5]);
                var1.put("cpu", var3[6]);
                var1.put("locationMode", var3[7]);
                var1.put("protocolType", var3[8]);
                var1.put("isNeedObjectStorage", var3[9]);
                return var1;
            } else {
                return null;
            }
        }
    }

    protected final void g() {
        this.f.a("client", (String)null);
        this.f.a("gather_interval", (String)null);
        this.f.a("pack_interval", (String)null);
        this.f.a("loc_time_offset", (String)null);
        this.f.a();
    }

    protected final void a(Message var1) {
        Bundle var9;
        int var2 = (var9 = var1.getData()).getInt("pushId");
        byte var3 = var9.getByte("infoType");
        String var4 = var9.getString("infoContent");
        long var6 = var9.getLong("timeStamp");
        byte[] var10 = ax.a(13, e.a());
        if(var10 != null && this.c != null) {
            this.c.a(var10, (com.baidu.trace.c.f.a)null);
        }

        if(this.a(var2, var6) && this.h != null) {
            try {
                this.h.pushCallback(var3, var4);
                return;
            } catch (RemoteException var8) {
                ;
            }
        }

    }

    protected final void b(Message var1) {
        if(this.h != null) {
            try {
                this.h.pushCallback(4, (String)var1.obj);
            } catch (RemoteException var2) {
                ;
            }
        }
    }

    protected final boolean a(short var1, int var2, com.baidu.trace.c.f.a var3) {
        if(18 == var1 && !TextUtils.isEmpty(g.a) && !TextUtils.isEmpty(g.c) && !TextUtils.isEmpty(g.d)) {
            return true;
        } else {
            byte[] var4 = ax.a(var1, var2);
            if(var4 == null) {
                return false;
            } else {
                if(this.c != null) {
                    this.c.a(var4, var3);
                }

                return true;
            }
        }
    }

    protected final void h() {
        if(b.c != this.n && b.d != this.n) {
            if(this.c != null) {
                this.n = b.b;
                this.c.b();
                this.c.c();
            }

        }
    }

    private boolean a(int var1, long var2) {
        String var4 = this.f.a("pushInfo");
        if(var4 == null) {
            var4 = var2 + "_" + var1 + ";";
            this.f.a("pushInfo", var4);
            this.f.a();
            return true;
        } else {
            String[] var5;
            int var6 = (var5 = var4.split(";")).length;

            for(int var7 = 0; var7 < var6; ++var7) {
                String var8;
                if(TextUtils.isEmpty(var8 = var5[var7])) {
                    return true;
                }

                String[] var9;
                if((var9 = var8.split("_")).length < 2) {
                    var4 = var4.replace(var8 + ";", "");
                } else {
                    long var11;
                    int var14;
                    try {
                        var11 = Long.valueOf(var9[0]).longValue();
                        var14 = Integer.valueOf(var9[1]).intValue();
                    } catch (Exception var13) {
                        return false;
                    }

                    if(var1 == var14) {
                        return false;
                    }

                    if(var2 - var11 >= 900L) {
                        var4 = var4.replace(var8 + ";", "");
                    }
                }
            }

            var4 = var4 + var2 + "_" + var1 + ";";
            this.f.a("pushInfo", var4);
            this.f.a();
            return true;
        }
    }

    private void i() {
        TraceJniInterface.a().socketDisconnection();
        if(this.c != null) {
            this.c.b();
        }

    }

    public final LBSTraceService.a getTraceHandler() {
        return this.a;
    }

    public final void setClientListener(IListener var1) {
        this.h = var1;
    }

    public final IListener getClientListener() {
        return this.h;
    }

    public final int getLocationMode() {
        return this.l;
    }

    public final Context getServiceContext() {
        return this.e;
    }

    static {
        LBSTraceService.class.getSimpleName();
    }

    static class ServiceBinder extends Stub {
        private WeakReference<LBSTraceService> service = null;

        public ServiceBinder(LBSTraceService var1) {
            this.service = new WeakReference(var1);
        }

        public void stopTrace(long var1, String var3) throws RemoteException {
            try {
                ((LBSTraceService)this.service.get()).f();
            } catch (RemoteException var4) {
                ;
            }
        }

        public boolean queryRealTimeLoc(TraceLocation var1) throws RemoteException {
            return false;
        }

        public int stopGather() throws RemoteException {
            return LBSTraceService.b((LBSTraceService)this.service.get());
        }

        public int startGather() throws RemoteException {
            return LBSTraceService.c((LBSTraceService)this.service.get());
        }

        public boolean setProtocolType(int var1) throws RemoteException {
            com.baidu.trace.c.a.b = var1 == 0?ProtocolType.HTTP:ProtocolType.HTTPS;
            return true;
        }

        public boolean setLocationMode(int var1) throws RemoteException {
            return ((LBSTraceService)this.service.get()).d(var1);
        }

        public boolean setInterval(int var1, int var2) throws RemoteException {
            ((LBSTraceService)this.service.get()).a(var1, var2);
            return true;
        }

        public boolean setCacheSize(int var1) throws RemoteException {
            return ((LBSTraceService)this.service.get()).b(var1);
        }

        public boolean setLocTimeOffset(int var1) throws RemoteException {
            return ((LBSTraceService)this.service.get()).c(var1);
        }

        public void registerListener(IListener var1) throws RemoteException {
            ((LBSTraceService)this.service.get()).setClientListener(var1);
            if(((LBSTraceService)this.service.get()).i) {
                var1.startTraceCallback(19);
                LBSTraceService.a((LBSTraceService)this.service.get(), false);
            }

        }

        public void unregisterListener() throws RemoteException {
            ((LBSTraceService)this.service.get()).setClientListener((IListener)null);
        }

        public boolean handleLocalFence(int var1, long var2, String var4) throws RemoteException {
            Editor var5 = ((LBSTraceService)this.service.get()).e.getSharedPreferences("com.baidu.trace_fence_status", 0).edit();
            JSONObject var10;
            CircleFence var13;
            switch(var1) {
                case 0:
                    try {
                        var10 = new JSONObject(var4);
                        var13 = CircleFence.buildLocalFence(var2, (String)null, (String)null, (LatLng)null, 0.0D, 0, CoordType.bd09ll);
                        com.baidu.trace.a.a(var10, var13);
                        if(ar.a != null) {
                            ar.a.a(var2, var13);
                        }
                    } catch (JSONException var7) {
                        ;
                    }
                    break;
                case 1:
                    try {
                        var10 = new JSONObject(var4);
                        var13 = CircleFence.buildLocalFence(var2, (String)null, (String)null, (LatLng)null, 0.0D, 0, CoordType.bd09ll);
                        com.baidu.trace.a.a(var10, var13);
                        if(ar.a != null) {
                            ar.a.a(var2, var13);
                            var5.remove(String.valueOf(var2));
                            var5.apply();
                        }
                    } catch (JSONException var6) {
                        ;
                    }
                    break;
                case 2:
                    if(ar.a != null) {
                        String[] var9 = var4.split(",");

                        try {
                            String[] var12 = var9;
                            var1 = var9.length;

                            for(int var11 = 0; var11 < var1; ++var11) {
                                String var3 = var12[var11];
                                ar.a.a(Long.valueOf(var3).longValue());
                                var5.remove(var3);
                                var5.apply();
                            }
                        } catch (Exception var8) {
                            ;
                        }
                    }
                    break;
                case 3:
                    if(ar.a != null) {
                        ar.a.c();
                        var5.clear();
                        var5.apply();
                    }
            }

            return false;
        }

        public void handleExtendedOperate(int var1) throws RemoteException {
            if(((LBSTraceService)this.service.get()).g) {
                g.b();
                ((LBSTraceService)this.service.get()).a(18, e.a(), (com.baidu.trace.c.f.a)null);
            }

        }
    }

    static class a extends Handler {
        private WeakReference<LBSTraceService> a = null;

        public a(LBSTraceService var1) {
            this.a = new WeakReference(var1);
        }

        public final void handleMessage(Message var1) {
            super.handleMessage(var1);
            LBSTraceService var2 = (LBSTraceService)this.a.get();
            if(var2 != null) {
                switch(var1.what) {
                    case 1:
                        var2.a();
                        return;
                    case 4:
                        var2.d();
                        return;
                    case 19:
                        var2.e();
                        return;
                    case 23:
                        var2.g();
                        return;
                    case 24:
                        var2.h();
                        return;
                    case 28:
                        var2.b();
                        return;
                    case 29:
                        var2.c();
                        return;
                    case 30:
                        var2.a(var1.arg1);
                        return;
                    case 31:
                        if(var2.g) {
                            var2.a(18, e.a(), (com.baidu.trace.c.f.a)null);
                            return;
                        }
                        break;
                    case 32:
                        LBSTraceService.a(var2, var1.arg1);
                        break;
                    case 141:
                        var2.e(var1.arg1);
                        return;
                    case 161:
                        var2.a(var1);
                        return;
                    case 163:
                        var2.b(var1);
                        return;
                }

            }
        }
    }
}
